package com.voxel.sense.infomsg.widget.adapter;

import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import com.example.com.common.view.recycler.RecyclerAdapter;
import com.voxel.sense.infomsg.R;
import com.voxel.sense.infomsg.data.bean.ConditionBean;
import cyy.example.com.facotry.Factory;

import java.util.List;

/**
 * Created by chenyiyao on 2017/11/3.
 */

public class FilterRecyclerSpareAdapter extends AbsPickRecyclerAdapter {

    private final int TYPE_2 = R.layout.item_recycle_flow_drop_down; //item布局


    public FilterRecyclerSpareAdapter(AdapterListener listener, List<ConditionBean> list, String data_type) {
        super(list, listener);
    }

    public FilterRecyclerSpareAdapter(AdapterListener listener, String data_type) {
        super(listener);
    }


   public FilterRecyclerSpareAdapter() {
        super();
    }




    @Override
    protected int getItemViewType(int position, ConditionBean conditionBean) {
        return TYPE_2;
    }

    @Override
    protected ViewHolder<ConditionBean> onCreateViewHolder(View root, int viewType) {
        return new ItemViewHolder(root);
    }

    @Override
    protected boolean handlerSatu(ConditionBean conditionBean) {
        return true;
    }


    static class ItemViewHolder extends RecyclerAdapter.ViewHolder<ConditionBean> {
        TextView mText;
        View root;

        public ItemViewHolder(View itemView) {
            super(itemView);
            this.root = itemView;
            this.mText = itemView.findViewById(R.id.text);
        }

        @Override
        protected void onBind(ConditionBean conditionBean) {
            mText.setText(conditionBean.getDesc());
            mText.setSelected(conditionBean.isSelect());
            if (conditionBean.isSelect()) {
                mText.setTextColor(Color.WHITE);
            } else {
                int color = Factory.app().getResources().getColor(R.color.pick_drop_menu_btn_text);
                mText.setTextColor(color);
            }

        }
    }
}
